package com.supreme.nettyapp.generalclient.component;

import com.supreme.nettyapp.generalclient.beatclient.handler.BeatClientHandler;
import com.supreme.nettyapp.generalclient.beatclient.handler.BeatClientInitializer;
import com.supreme.nettyapp.generalclient.beatclient.service.BeatClientService;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class NettyClientSpringStarter implements ApplicationRunner {

    @Resource
    private BeatClientService beatClientService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
//        BeatClientHandler beatClientHandler = new BeatClientHandler();
//        BeatClientInitializer beatClientInitializer = BeatClientInitializer.INSTANCE;
//        beatClientInitializer.setBeatClientHandler(beatClientHandler);
        beatClientService.buildBootstrap();
        beatClientService.startNettyClient("192.168.50.132", 14018);
        beatClientService.startNettyClient("192.168.50.132", 14019);
//        beatClientService.startNettyClient("192.168.100.65", 554);
//        beatClientService.startNettyClient("192.168.1.106", 80);
    }
}
